package com.nengchuan.eic.nceconomy.constant;

import com.nengchuan.eic.nceconomy.entity.vo.SheetInfoVO;

import java.util.stream.Stream;

/**
 * 功能描述:
 *
 * @Author: liurui
 * @Date: 2020/4/23 0023 下午 1:42
 */

public enum  SheetDataEnum {
    //通用模板sheet排版
    NORMAL_TITLE("title", 0,0,0,0,"","",""),
    NORMAL_TABLEHEAD("tableHead", 0,0,1,1,"","",""),
    NORMAL_HEADLINE("headLine", 0,0,2,2,"","",""),
    TABLE2_YI_HEADLINE("headLine", 0,0,2,3,"","","安装部分汇总表（表二甲）"),
    TABLE2_JIA_HEADLINE("headLine", 0,0,2,3,"","","建筑部分汇总表（表二乙）"),
    TABLE3_BIN_HEADLINE("headLine", 0,0,2,4,"","","架空输电线路工程单位工程汇总表（表三丙）"),
    TABLE3_YI_HEADLINE("headLine", 0,0,2,3,"","","建筑单位工程汇总表（表三乙）"),
    TABLE3_JIA_HEADLINE("headLine", 0,0,2,3,"","","安装单位工程汇总表（表三甲）"),
    NULL("", null,null ,null,null,"","","");

    String name;
    Integer rowStartCoordinates;
    Integer rowEndCoordinates;
    Integer lineStartCoordinates;
    Integer lineEndCoordinates;
    String categoryIndex;
    String projectIndex;
    String templateName;

    SheetDataEnum(String name, Integer rowStartCoordinates, Integer rowEndCoordinates,Integer lineStartCoordinates,Integer lineEndCoordinates,String categoryIndex,String projectIndex,String templateName) {
        this.rowStartCoordinates = rowStartCoordinates;
        this.rowEndCoordinates = rowEndCoordinates;
        this.lineStartCoordinates = lineStartCoordinates;
        this.lineEndCoordinates = lineEndCoordinates;
        this.name = name;
        this.categoryIndex = categoryIndex;
        this.projectIndex = projectIndex;
        this.templateName = templateName;
    }

    public String getName() {
        return name;
    }
    public Integer getRowStartCoordinates() {
        return rowStartCoordinates;
    }
    public Integer getRowEndCoordinates() {
        return rowEndCoordinates;
    }
    public Integer getLineStartCoordinates() {
        return lineStartCoordinates;
    }
    public Integer getLineEndCoordinates() {
        return lineEndCoordinates;
    }
    public String getTemplateName() {
        return templateName;
    }
    public String getCategoryIndex() {
        return categoryIndex;
    }
    public String getProjectIndex() {
        return projectIndex;
    }


    public  static  Integer getTitleLineNumByTemplateSheetName(String templateName){
        return Stream.of(SheetDataEnum.values()).filter(x-> x.getTemplateName().equals(templateName)&&"title".equals(x.getName())).findFirst().orElse(SheetDataEnum.NORMAL_TITLE).getLineStartCoordinates();
    }

    public  static  Integer getTableheadLineNumByTemplateSheetName(String templateName){
        return Stream.of(SheetDataEnum.values()).filter(x->x.getTemplateName().equals(templateName)&&"tableHead".equals(x.getName())).findFirst().orElse(SheetDataEnum.NORMAL_TABLEHEAD).getLineStartCoordinates();
    }

    public  static  SheetDataEnum getHeadlineNumByTemplateSheetName(String templateName){
        return Stream.of(SheetDataEnum.values()).filter(x->x.getTemplateName().equals(templateName)&&"headLine".equals(x.getName())).findFirst().orElse(SheetDataEnum.NORMAL_HEADLINE);
    }

}
